<?php

/**
 * Description of ContentContact
 *
 * @author Honza
 */
class ContentContact implements IMainBodyWithInteraction {

  public function getContent() {
    $content = '';
    $content .= '<h2>Contact us</h2>';
    
    $formID = $this->getSubmitedForm();
    if ($formID > 0) {
      $content .= $this->applyForm($formID);
    } else {
      $content .= $this->getForm($formID);
    }
    
    return $content;
  }

  public function applyForm($formID = NULL) {
    return '<p>Thank you for contacting us.</p>';
  }

  public function getForm($formID = NULL, $error = NULL) {
    $f = new Form();
    $f->startForm("self", "post", null, array("class" => "form_settings"))->addLabel("Your name", "your_name")->addInput("text", "your_name");
    $f->addLabel("Email", "your_email")->addInput("text", "your_email");
    $f->addLabel("Message", "your_enquiry")->addTextArea("your_enquiry", "", array("class" => "contact textarea", "rows" => "8", "cols" => "50"));
    $f->addLabel("&nbsp;", "contact_submitted")->addInput("submit", "contact_submitted", "Send", array("class" => "submit"));
    $f->endForm();
    $form .= '<p>Do you want ask us? Use form bellow.</p>';
    $form .= $f->getForm();
    return $form;
  }

  public function getSubmitedForm() {
    if (isset($_POST['contact_submitted'])) {
      return 1;
    }
    
    return -1;
  }

  public function action() {
    
  }

  public function getTable($tableID = NULL) {
    
  }

}

?>
